﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Practices.Unity;
using System.Transactions;
namespace Skynet.BusinessLogic.Test.DataAccess
{
     [TestClass]
    public class KindTest
    {
         private static IUnityContainer Container;
         [ClassInitialize()]
         public static void Initialize(TestContext testContext)
         {

             Container = UnityHelper.BuildUnityContainer();
         }
         [TestMethod]
         public void KindCRUD()
         {
             var rep = Container.Resolve<BusinessLogic.DataAccess.IKindRepository>();
             var kind = new BusinessEntities.Kind();
             kind.Id = Guid.NewGuid();
             kind.Title = "test";
             kind.Description = "test";

             rep.Add(kind);



             var target = rep.GetOne(kind.Id);
             Assert.IsNotNull(target);

             kind.Description = "change test";
             rep.Update(kind);

             target = rep.GetOne(kind.Id);

             Assert.AreEqual<string>(target.Description, "change test");

             rep.Delete(kind);
             target = rep.GetOne(kind.Id);
             Assert.IsNull(target);



         }
    }
}
